Skip to content

Fix Social SDK leaving lobby #7540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged

Fix Social SDK leaving lobby #7540

merged 1 commit into from
May 8, 2025

Conversation

thiagola92
Copy link
Contributor

In the section Managing Lobbies, the code for Leaving a Lobby:

// Leaving a lobby from the client
client->LeaveLobby(01234567890, [](discordpp::ClientResult result, uint64_t lobbyId) {
  if(result.Successful()) {
    std::cout << "🎮 Left lobby successfully! Lobby Id: " << lobbyId << std::endl;
  } else {
    std::cerr << "❌ Leaving lobby failed\n";
  }
}

Mention a uint64_t lobbyId which doesn't seem to exist in LeaveLobbyCallback.

I was thinking in changing the example to:

// Leaving a lobby from the client
client->LeaveLobby(01234567890, [](discordpp::ClientResult result) {
  if(result.Successful()) {
    std::cout << "🎮 Left lobby successfully! Lobby Id: 01234567890\n";
  } else {
    std::cerr << "❌ Leaving lobby failed\n";
  }
}

@thiagola92 thiagola92 requested a review from a team as a code owner May 5, 2025 06:16
@thiagola92 thiagola92 requested review from colinloretz and removed request for a team May 5, 2025 06:16
@markmandel
Copy link
Contributor

Totally off the top of my head:

// Leaving a lobby from the client
uint64_t lobbyId = 01234567890;
client->LeaveLobby(lobbyId, [&](discordpp::ClientResult result) {
  if(result.Successful()) {
    std::cout << "🎮 Left lobby successfully! Lobby Id: " << lobbyId << std::endl;
  } else {
    std::cerr << "❌ Leaving lobby failed\n";
  }
}

But I think that will work, and you can see it get passed through? WDYT?

@thiagola92
Copy link
Contributor Author

I like it.

In this case, I could also change the example from Sending Messages to a Lobby to match it:

uint64_t lobbyId = 01234567890;

client->SendLobbyMessage(lobbyId, "Hello", [](discordpp::ClientResult result, uint64_t messageId) {
  if(result.Successful()) {
    std::cout << "📨 Message sent successfully!\n";
  } else {
    std::cerr << "❌ Message sending failed\n";
  }
});

Note: can I also add a space between creating variable and the function calling?

@markmandel
Copy link
Contributor

Sure - that works for me 👍🏻 sounds good!

No concerns on extra line break 😄

@thiagola92
Copy link
Contributor Author

Done 👍

Copy link
Contributor

@markmandel markmandel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! Will go live with next push 👍🏻

@markmandel markmandel merged commit 75b3155 into discord:main May 8, 2025
4 checks passed
@colinloretz colinloretz added the social-sdk Feedback and PRs on Social SDK label May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
social-sdk Feedback and PRs on Social SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants